package com.um.jdy.platform.device.controller;

import com.um.jdy.common.device.entity.dto.PortAlarmRecordDTO;
import com.um.jdy.common.device.entity.po.PortAlarmRecord;
import com.um.jdy.common.device.entity.vo.PortAlarmRecordVO;
import com.um.jdy.common.device.service.PortAlarmRecordService;
import com.um.jdy.platform.device.entity.dto.*;
import com.um.jdy.platform.device.entity.vo.AlarmRecordItemVO;
import com.um.jdy.platform.device.manger.PortAlarmRecordManager;
import com.um.springboot.starter.annotation.ApiPermission;
import com.um.springboot.starter.annotation.TokenRequired;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.controller.BasePlusController;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.params.ListDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 控制器：充电桩表
 */
@RestController
@RequestMapping("/api/v1/cms/device/alarm_record")
@Api(tags = "设备告警", description = "充电桩告警表")
@ApiPermission("device_alarm")
@TokenRequired
@Validated
public class PortAlarmRecordController extends BasePlusController<PortAlarmRecordManager, PortAlarmRecordService, PortAlarmRecord, PortAlarmRecordDTO, PortAlarmRecordVO,AlarmRecordPageDTO, ListDTO> {

    /**
     * 分页查询充电桩日志
     * @param params
     * @return
     */
    @ApiPermission("page")
    @ApiOperation("分页查询")
    @PostMapping("/record_page")
    public Response<Page<AlarmRecordItemVO>> getPage(@RequestBody AlarmRecordPageDTO params){
        return manager.getPage(params.toPageParams());
    }
}
